function cond=swolfe(a,x,p,c,f1)
% function to check whether the provided steplength satisfies strong 
% wolfe condition: |\eta \nable f^Tp| \ge |\nabla f(x+ap)^Tp|
% INPUT:
%       a-current steplength (1*1);
%       x-current iterate (n*1);
%       p-search direction (n*1);
%       c-constant provided by the user (1*1), in (0,1);
%       f1-the gradient of the function (Rn->Rn);
% OUTPUT:
%       cond-1 or 0 to present whether the condition holds;
% REVISION:
%       jqin, 15/feb/2011, created
if abs(c*f1(x)'*p)>=abs(f1(x+a*p)'*p)
    cond=1;
else 
    cond=0;
end
end